package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Reward;
import com.bohua.child.service.RewardService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 学生数量控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/reward")
public class RewardController {
    @Resource
    private RewardService rewardService;

    @RequestMapping
    public String reward(){
        return "reward/reward.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "reward/addReward.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "reward/updateReward.html";
    }

    @RequestMapping("/getRewards")
    @ResponseBody
    public Lay getRewards(Reward reward,Integer page,Integer limit){
        return rewardService.getRewards(reward,page,limit);
    }
    @RequestMapping("/addReward")
    @ResponseBody
    public Msg addReward(Reward reward){
        return rewardService.addReward(reward);
    }

    @RequestMapping("/updateReward")
    @ResponseBody
    public Msg updateReward(Reward reward){
        return rewardService.updateReward(reward);
    }

    @RequestMapping("/delReward")
    @ResponseBody
    public Msg delReward(Reward reward){
        return rewardService.delReward(reward);
    }
}
